From: Florian Müllner Date: Wed, 3 Aug 2022 04:44:36 +0000 (+0200) Subject: status/network: Add activate() in NMSection X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~461^2^2~45 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=88262a104263a4c4ae6b527dea050d35c1db9e16;p=gnome-shell.git status/network: Add activate() in NMSection As the sections are about to turn into quick toggles, they need to be able to perform an action on click. Add an activate() method for that purpose, which either disconnects all active items, or connects the primary item. Part-of: --- diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 1beab28c1..994c35c13 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -1343,6 +1343,15 @@ const NMSection = GObject.registerClass({ this.menu.actor.visible = visible; } + activate() { + const activeItems = [...this._getActiveItems()]; + + if (activeItems.length > 0) + activeItems.forEach(i => i.activate()); + else + this._itemBinding.source?.activate(); + } + _loadInitialItems() { throw new GObject.NotImplementedError(); }